From 9856c1b25a242b8ba030ea7bb2567c3de80f54ae Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 23 Nov 2005 17:11:36 +0000 Subject: [PATCH] Document symbolic colors and color expressions. 2005-11-23 Matthias Clasen * gtk/tmpl/gtkrc.sgml: Document symbolic colors and color expressions. --- ChangeLog | 5 +++ ChangeLog.pre-2-10 | 5 +++ docs/reference/ChangeLog | 5 +++ docs/reference/gtk/tmpl/gtkrc.sgml | 63 +++++++++++++++++++++++++++++- gtk/gtksettings.c | 16 ++++++++ 5 files changed, 92 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc7f3f6963..4f6c6adea1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-11-23 Matthias Clasen + + * gtk/gtksettings.c (gtk_settings_class_init): Add some docs + about gtk-color-scheme. + 2005-11-23 Behdad Esfahbod * configure.in (enable_explicit_deps): Fix typo when checking diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index cc7f3f6963..4f6c6adea1 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2005-11-23 Matthias Clasen + + * gtk/gtksettings.c (gtk_settings_class_init): Add some docs + about gtk-color-scheme. + 2005-11-23 Behdad Esfahbod * configure.in (enable_explicit_deps): Fix typo when checking diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index c8b8629db4..6e2564aa8d 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,8 @@ +2005-11-23 Matthias Clasen + + * gtk/tmpl/gtkrc.sgml: Document symbolic colors and + color expressions. + 2005-11-23 Michael Natterer * gtk/gtk-sections.txt: add gtk_style_lookup_color diff --git a/docs/reference/gtk/tmpl/gtkrc.sgml b/docs/reference/gtk/tmpl/gtkrc.sgml index 1282268b6c..0751551aa6 100644 --- a/docs/reference/gtk/tmpl/gtkrc.sgml +++ b/docs/reference/gtk/tmpl/gtkrc.sgml @@ -440,6 +440,15 @@ elements are: + + color["color-name"] = color specification + + + Since 2.10, this element can be used to defines symbolic colors. See below for + the syntax of color specifications. + + + engine "engine" { engine-specific settings } @@ -520,8 +529,7 @@ state of the widget. The states are: Colors can be specified as a string containing a color name (GTK+ knows -all names from the X color database -/usr/lib/X11/rgb.txt), +all names from the X color database /usr/lib/X11/rgb.txt), in one of the hexadecimal forms #rrrrggggbbbb, #rrrgggbbb, #rrggbb, or #rgb, where r, @@ -532,6 +540,56 @@ hex digits, or they can be specified as a triplet g and b are either integers in the range 0-65535 or floats in the range 0.0-1.0. + +Since 2.10, colors can also be specified by refering to a symbolic color, as +follows: @color-name, or by using expressions to combine +colors. The following expressions are currently supported: + + + mix (factor, color1, color2) + + Computes a new color by mixing color1 and + color2. The factor + determines how close the new color is to color1. + A factor of 1.0 gives pure color1, a factor of + 0.0 gives pure color2. + + + + + shade (factor, color) + + Computes a lighter or darker variant of color. + A factor of 1.0 leaves the color unchanged, smaller + factors yield darker colors, larger factors yield lighter colors. + + + + + lighter (color) + + This is an abbreviation for + shade (1.3, color). + + + + + darker (color) + + This is an abbreviation for + shade (0.7, color). + + + + + +Here are some examples of color expressions: + + mix (0.5, "red", "blue") + shade (1.5, mix (0.3, "#0abbc0", { 0.3, 0.5, 0.9 })) + lighter (@foreground) + + In a stock definition, icon sources are specified as a @@ -744,6 +802,7 @@ specific portions of a RC file. @GTK_RC_TOKEN_STOCK: @GTK_RC_TOKEN_LTR: @GTK_RC_TOKEN_RTL: +@GTK_RC_TOKEN_COLOR: @GTK_RC_TOKEN_LAST: diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c index f57a056f27..15b9f45f03 100644 --- a/gtk/gtksettings.c +++ b/gtk/gtksettings.c @@ -433,6 +433,22 @@ gtk_settings_class_init (GtkSettingsClass *class) g_assert (result == PROP_TIMEOUT_REPEAT); + /** + * GtkSettings:gtk-color-scheme: + * + * A palette of named colors for use in themes. The format of the string is + * + * name1: color1 + * name2: color2 + * ... + * + * Color names must be acceptable as identifiers in the + * gtkrc syntax, and + * color specifications must be in the format accepted by + * gdk_color_parse(). + * + * Since: 2.10 + */ result = settings_install_property_parser (class, g_param_spec_string ("gtk-color-scheme", P_("Color scheme"), -- 2.30.2